<?php
class SENDMAIL {
	function send($to, $recipient_name, $subject, $body) {
		$mail = new PHPMailer ();
		$mail->IsSMTP (); // set mailer to use SMTP
		$mail->CharSet = 'utf-8'; 
		$mail->Host = "smtp.gmail.com"; // specify main and backup server
		$mail->Port = 465; // set the port to use
		$mail->SMTPAuth = true; // turn on SMTP authentication
		$mail->SMTPSecure = 'ssl';
		$mail->Username = "muahoi1@gmail.com"; // your SMTP username or your gmail username
		$mail->Password = "tuananh123"; // your SMTP password or your gmail password
		$from = "muahoi@muahoi.com"; // Reply to this email
		//$to = "thanhphi89@gmail.com"; // Recipients email ID
		$name = $recipient_name; // Recipient's name
		$mail->From = $from;
		$mail->FromName = "Mua Hội"; // Name to indicate where the email came from when the recepient received
		$mail->AddAddress ( $to, $name );
		$mail->AddReplyTo ( $from, "Mua Hội" );
		$mail->WordWrap = 50; // set word wrap
		$mail->IsHTML ( true ); // send as HTML
		$mail->Subject = $subject;
		$mail->Body = $body; //HTML Body
		$mail->AltBody = ""; //Text Body
		if (! $mail->Send ()) {
			return true;
		} else {
			return false;
		}
	}
}

?>